#主线程等待子线程先结束才结束
#线程的运行是没有先后顺序
from threading import Thread
import threading,time
def test1():
    for i in range(5):
        print(f'...test1...{i}')
        time.sleep(1)
#如果创建target时，指定的函数运行结束，那么意味着这个子线程结束了

def test2():
    for i in range(10):
        print(f'...test2...{i}')
        time.sleep(1)


def main():
    t1=Thread(target=test1)
    t2=Thread(target=test2)

    t1.start()
    t2.start()
    while True:
        print(threading.enumerate())
        if len(threading.enumerate())<=1:
            break
        time.sleep(1)

if __name__ == '__main__':
    main()